xentrace: correct overflow check for number of per-cpu trace pages
authorOlaf Hering <olaf@aepfle.de>
Mon, 18 Apr 2011 14:12:04 +0000 (15:12 +0100)
committerOlaf Hering <olaf@aepfle.de>
Mon, 18 Apr 2011 14:12:04 +0000 (15:12 +0100)
commit6b135a421024a8a1439b4b30c84954160ace316b
tree158f343eca187c8858c59ee2afe859411473fe44
parentdeb245252e80db10906d42dd831d1927ded9c294
xentrace: correct overflow check for number of per-cpu trace pages

The calculated number of per-cpu trace pages is stored in t_info and
shared with tools like xentrace. Since its an u16 the value may
overflow because the current check is based on u32.  Using the u16
means each cpu could in theory use up to 256MB as trace
buffer. However such a large allocation will currently fail on x86 due
to the MAX_ORDER limit.  Check both max theoretical number of pages
per cpu and max number of pages reachable by struct t_buf->prod/cons
variables with requested number of pages.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
xen/common/trace.c